use cgmath::{vec2, Vector2};

pub struct RegionRect {
    pub left_top: Vector2<f32>,
    pub right_bottom: Vector2<f32>,
}

impl RegionRect {
    pub fn new(left: f32, top: f32, right: f32, bottom: f32) -> Self {
        Self {
            left_top: vec2(left, top),
            right_bottom: vec2(right, bottom),
        }
    }

    pub fn left_bottom(&self) -> Vector2<f32> {
        vec2(self.left_top.x, self.right_bottom.y)
    }

    pub fn right_top(&self) -> Vector2<f32> {
        vec2(self.right_bottom.x, self.left_top.y)
    }

    pub fn left_top(&self) -> Vector2<f32> {
        self.left_top
    }

    pub fn right_bottom(&self) -> Vector2<f32> {
        self.right_bottom
    }

    pub fn left(&self) -> f32 {
        self.left_top.x
    }

    pub fn right(&self) -> f32 {
        self.right_bottom.x
    }

    pub fn top(&self) -> f32 {
        self.left_top.y
    }

    pub fn bottom(&self) -> f32 {
        self.right_bottom.y
    }
}